package com.guidecaptain.java.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.SelectKey;

import com.guidecaptain.java.model.pojo.User;

public interface UserMapper {
	
	@Insert("insert into user (username, psw,name,role,gmt_creat) values ( #{username}, #{psw},#{name},#{role},now())")
	@SelectKey(statement="SELECT LAST_INSERT_ID() AS ID ",keyProperty="userId",resultType=int.class, before = false)
	int insertUser(User user);

	@Delete("delete from user where user_id=#{userId}")
	int deleteUser(int userId);
	
	int updateUser(User user);
	
	User queryUser(User user);
	
	List<User> queryUserList();
	
}
